//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.util;

import com.mdx.api.autocode.fileread.Api;
import com.mdx.api.autocode.fileread.ApiInfo;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class Tool {
    public Tool() {
    }

    public static boolean myMatch(String word, String content) {
        word = word.trim().toLowerCase();
        content = content.trim().toLowerCase();
        String[] ss = word.split("");
        word = ".*";
        String[] var3 = ss;
        int var4 = ss.length;

        for(int var5 = 0; var5 < var4; ++var5) {
            String t = var3[var5];
            word = word + t + ".*";
        }

        System.out.println(word);
        return content.matches(word);
    }

    public static List<Api> spliceList(List<ApiInfo> list) {
        ArrayList listapi = new ArrayList();
        Iterator var2 = list.iterator();

        while(var2.hasNext()) {
            ApiInfo ai = (ApiInfo)var2.next();
            listapi.addAll(ai.getApis());
        }

        return listapi;
    }

    public static String TraverseMap(Map map) {
        String str = "";
        Set set = map.keySet();

        Object obj;
        for(Iterator it = set.iterator(); it.hasNext(); str = str + obj + "\n" + map.get(obj)) {
            obj = it.next();
        }

        return str;
    }

    public static String findApiId(String str) {
        int index = str.indexOf("(");
        return str.substring(0, index);
    }

    public static List<Api> search(List<Api> listApi, String word) {
        ArrayList list = new ArrayList();
        word = word.trim().toLowerCase();
        Iterator var3 = listApi.iterator();

        while(true) {
            Api api;
            String id;
            String remark;
            do {
                if(!var3.hasNext()) {
                    return list;
                }

                api = (Api)var3.next();
                id = api.getId().toLowerCase();
                remark = api.getRemark().toLowerCase();
            } while(!id.contains(word) && !remark.contains(word));

            list.add(api);
        }
    }
}
